# -*- coding: utf-8 -*-
import scrapy

from nbanews.items import nbanewsItem

class nbanewsSpider(scrapy.Spider):
    
    name = 'nbanews'
    
    allowed_domains = ["zhibo8.cc"]
    
    start_urls = "https://news.zhibo8.cc/nba/"
    
    def parse(self, response):
        for each in response.xpath("//*[@id='middle']/div[1]/div[2]/div[2]"):
            # 初始化模型对象 //*[@id="middle"]/div[1]/div[2]/div[2]/ul[1]/li[1]/a
            item = TencentItem()

            item['positionname'] = each.xpath("./ul/li/a/text()").extract()[0]
            # 详情连接
            item['positionlink'] = each.xpath("./ul/li/a/@href").extract()[0]
            # 职位类别
            

            yield item
        yield scrapy.Request(self.url,callback = self.parse)